<?php
require_once "Facebook/base_facebook.php";
require_once "Facebook/facebook.php";

/**
 * Extends the BaseFacebook class with the intent of using
 * PHP sessions to store user ids and access tokens.
 */
class Bemigo_Service_Facebook extends Facebook
{

  public function __construct($config) {
    parent::__construct($config);
  }

  public function getLikes($id = "me"){
  	return $this->api('/'.$id.'/likes');
  }

  public function getAlbums($id = "me"){
  	return $this->api('/'.$id.'/albums');
  }

  public function getBooks($id = "me"){
  	return $this->api('/'.$id.'/books');
  }

  public function getPhotos($id = "me"){
  	return $this->api('/'.$id.'/photos');
  }

  public function getPicture($id = "me"){
  	return $this->api('/'.$id.'/picture');
  }

  public function getTelevision($id = "me"){
  	return $this->api('/'.$id.'/television');
  }

  public function getMovies($id = "me"){
  	$response = array();
  	try{
  		$movies = $this->api('/'.$id.'/movies');
  		foreach ($movies as $movie){
  			foreach($movie as $m){
  				$response["fb_".$m['id']] = $m;
  			}
  		}
  	}catch(Exception $e){
  		throw new Zend_Service_Exception($e->getMessage());
  	}
  	return $response;
  }

  public function getMusic($id = "me"){
  	return $this->api('/'.$id.'/music');
  }

  public function getInfo($id = "me"){
  	return $this->api('/'.$id);
  }

}
